// @ts-ignore
import cookie from 'js-cookie'
import {message} from "ant-design-vue";
import {getUserInfo} from "@/api/home";
import router from "@/router";

export async function checkUserLogin(): Promise<boolean> {
    if (cookie.get("userinfo") != null) {
        const res = await getUserInfo()
        if (res.data.code === 400) {
            cookie.remove("token")
            cookie.remove("userinfo")
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
}